package com.pro.common.listener;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.pro.common.utils.SpringContextUtil;
import com.pro.db.domain.GuopuCategory;
import com.pro.db.service.itf.IGuopuCategoryService;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;

public class StartListener implements ApplicationListener<ContextRefreshedEvent> {
    private final Log logger = LogFactory.getLog(StartListener.class);

    IGuopuCategoryService categoryService;

    @Override
    public void onApplicationEvent(ContextRefreshedEvent event) {
        categoryService = SpringContextUtil.getBean(IGuopuCategoryService.class);
        categoryService.list(new QueryWrapper<GuopuCategory>()
            .eq("level","L1"));
        logger.info("程序启动");
        logger.info("程序启动");
        logger.info("程序启动");
        logger.info("程序启动");
        logger.info("程序启动");
        logger.info("程序启动");
    }

}
